Repository navigation
build: publish the attw CLI as a self-contained binary - #10
Merged
Merged
Conversation
The published CLI declared five runtime dependencies and externalized them, so installing it pulled the analyzer, effect, and a compiler into the consumer's tree, and the analyzer ran whatever TypeScript the host hoisted. Inline every dependency into the single dist/main.mjs entry, drop the library entry for AttwHandler that nothing outside the package imports, and move the former runtime dependencies to devDependencies. deps.onlyImport fails the build if a bare import survives, so the manifest cannot drift from the bundle; the inlined TypeScript is the analyzer's own pinned 6.0.3. The published manifest now exposes only bin. Verified by packing, installing the tarball in an empty project (npm adds exactly one package, then the bin link resolves), and running attw --pack on an ESM-only fixture from the installed binary
`prepare` ran tsdown on every `pnpm install`, before any package was built. The bundle inlines the analyzer, so on a fresh clone the analyzer's dist/ did not exist yet, rolldown left it external, and the onlyImport gate failed the install with "@systemfsoftware/arethetypeswrong is imported in main.mjs but is not included in deps.onlyImport option" — the Commitlint workflow's `pnpm install --frozen-lockfile` broke on it. turbo already orders this: every task that needs dist depends on `^build`, so `pnpm build` builds the analyzer before the CLI. Install no longer builds, and the bundle is produced by the task graph that knows the order
The note was added alongside the bundling change without being part of it. The package page describes what the CLI does; what changed about its packaging belongs to the release note
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Installing the CLI no longer drags its dependency tree into your project:
attwnow publishes as one self-contained binary, its manifest exposes only thebinentry, and the analyzer always runs the TypeScript it was built against rather than whichever version your tree hoisted. The command, its flags, and its output are unchanged.What a consumer sees
npm installof the tarball adds exactly one package. Before, the CLI's five runtime dependencies — including the analyzer and a TypeScript compiler — resolved inside the consumer'snode_modules, where dedupe or hoisting could hand the analysis a different version of either.Design decisions
pnpm buildinstead of shipping a binary that dies in a consumer's tree.devDependenciesfor the workspace build.AttwHandler, a library entry nothing outside the package imported (checked across the workspace); the executable is the only artifact, and noexportsmap is published.Related: #8, #9
Validation
pnpm check:ci— format, lint, typecheck, typecheck:node, tests, build, and mutation all green.dist/main.mjs,LICENSE,README.md, andpackage.json; installed into an empty project (npm install, one package added), wherenode_modules/.bin/attw --packran a real analysis on an ESM-only fixture and exited 1 on the expected CJS failure.node_modulespresent at all.effectexternal: the build fails and names the offending import.